<div class="fm-content">
  <div class="title">
    <i nz-icon [type]="'desktop'"></i>
    &nbsp;&nbsp;Java服务端构建
  </div>
  <div class="work">
    <div class="top">
      <input nz-input placeholder="名称" class="fm-input first-input" [(ngModel)]="fs.queryObject['display:like']" />
      <nz-button-group>
        <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
        <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
      </nz-button-group>
      <div class="tool-right">

      </div>
    </div>

    <div class="work-content">
      <div class="table">
        <nz-table nzSize="middle" nzShowSizeChanger [nzShowPagination]="false" [nzFrontPagination]="false"
          [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing">
          <thead>
            <tr>
              <th nzWidth="40%">名称</th>
              <th nzWidth="20%">类型</th>
              <th nzWidth="40%">操作</th>
            </tr>
          </thead>
          <tbody>
            <ng-template ngFor let-data [ngForOf]="fs.datas">
              <ng-template ngFor let-item [ngForOf]="fs.expandDataCache[data.id]">
                <tr *ngIf="(item.parent&&item.parent.expand)||!(item.parent)">
                  <td [nzIndentSize]="item.level*20" [nzShowExpand]="!item.leaf" [(nzExpand)]="item.expand"
                    (nzExpandChange)="fs.collapse(item,$event)">
                    {{item.display}}({{item.id}})
                  </td>
                  <td>{{item.directoryTypeName}}</td>
                  <td>
                    <a *ngIf="item.directoryType=='2'" class="form-button" (click)="start(item, 1)">普通型</a>
                    <a *ngIf="item.directoryType=='2'" class="form-button" (click)="start(item, 2)">字典型</a>
                    <a *ngIf="item.directoryType=='2'" class="form-button" (click)="start(item, 3)">流程型</a>
                    <a *ngIf="item.directoryType=='2'" class="form-button" (click)="start(item, 4)">导出模板</a>
                  </td>
                </tr>
              </ng-template>
            </ng-template>
          </tbody>
        </nz-table>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="构建参数" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="bfs.isEditVisible"
      (nzOnCancel)="bfs.closeEdit()">
      <form nz-form [nzLayout]="'inline'">
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">元数据</nz-form-label>
              <nz-form-control class="form-control">
                {{bfs.er.mateID}}
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">工程名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="proName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="proName" name="proName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">包名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="packageName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="packageName" name="packageName">
              </nz-form-control>
            </nz-form-item>
          </div>

          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">表名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="tableName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.tableName" id="tableName" name="tableName"
                  #tableName="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">类名称</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="className.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.className" id="className" name="className"
                  #className="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">类别名</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="classAliseName.invalid?'error':'success'"
                nzHasFeedback>
                <input nz-input required [(ngModel)]="bfs.er.classAliseName" id="classAliseName" name="classAliseName"
                  #classAliseName="ngModel">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24" *ngIf="type===2">
          <div nz-col [nzSpan]="24">
            <nz-form-item>
              <nz-form-label class="form-label">字典名称</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.dicName" name="dicName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24" *ngIf="type===3">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">流程实例字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.exeidFieldName" name="exeidFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">流程状态字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.bpmStateFieldName" name="bpmStateFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24">
            <nz-form-item>
              <nz-form-label class="form-label">是否支持租户</nz-form-label>
              <nz-form-control class="form-control">
                <nz-switch nzCheckedChildren="是" nzUnCheckedChildren="否" [(ngModel)]="bfs.er.tenant" name="tenant">
                </nz-switch>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24" *ngIf="bfs.er.tenant">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">租户ID字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.tenantIDFieldName" name="tenantIDFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">租户名称字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.tenantNameFieldName" name="tenantNameFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">是否支持逻辑删除</nz-form-label>
              <nz-form-control class="form-control">
                <nz-switch nzCheckedChildren="是" nzUnCheckedChildren="否" [(ngModel)]="bfs.er.logicalDelete" name="logicalDelete">
                </nz-switch>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12" *ngIf="bfs.er.logicalDelete">
            <nz-form-item>
              <nz-form-label class="form-label">逻辑删除字段名</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.logicalDeleteFieldName" name="logicalDeleteFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">是否树型表</nz-form-label>
              <nz-form-control class="form-control">
                <nz-switch nzCheckedChildren="是" nzUnCheckedChildren="否" [(ngModel)]="bfs.er.tree" name="tree">
                </nz-switch>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12" *ngIf="bfs.er.tree">
            <nz-form-item>
              <nz-form-label class="form-label">树型表PID字段名</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.treePIDFieldName" name="treePIDFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">是否记录创建信息</nz-form-label>
              <nz-form-control class="form-control">
                <nz-switch nzCheckedChildren="是" nzUnCheckedChildren="否" [(ngModel)]="bfs.er.create" name="create">
                </nz-switch>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12" *ngIf="bfs.er.create">
            <nz-form-item>
              <nz-form-label class="form-label">创建时间字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.createTimeFieldName" name="createTimeFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24" *ngIf="bfs.er.create">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">创建人ID字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.createUserIDFieldName" name="createUserIDFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">创建人名称字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.createUserNameFieldName" name="createUserNameFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">是否记录更新信息</nz-form-label>
              <nz-form-control class="form-control">
                <nz-switch nzCheckedChildren="是" nzUnCheckedChildren="否" [(ngModel)]="bfs.er.update" name="update">
                </nz-switch>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12" *ngIf="bfs.er.update">
            <nz-form-item>
              <nz-form-label class="form-label">更新时间字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.updateTimeFieldName" name="updateTimeFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24" *ngIf="bfs.er.update">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">更新人ID字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.updateUserIDFieldName" name="updateUserIDFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label class="form-label">更新人名称字段</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input required [(ngModel)]="bfs.er.updateUserNameFieldName" name="updateUserNameFieldName">
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24" class="form-button-align">
            <button nz-button nzType="default" (click)="bfs.closeEdit()" class="form-button">取消</button>
            <button nz-button nzType="primary"
              [disabled]='proName.invalid || packageName.invalid || className.invalid || classAliseName.invalid || tableName.invalid'
              (click)="build()" [nzLoading]="bfs.isSaveing">构建</button>
          </div>
        </div>
      </form>
    </nz-modal>
  </div>
</div>